﻿<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//session_start();
header("Content-Type:text/html;charset=utf-8");

require_once '../../mail/smtp.php'; 


function sendVefifyMail($user_account,$useremail, $userid){
	
	//$userid=$_GET['id'];
	//$useremail = $_GET['email'];
	
	
	$idBinary = md5($userid);
	// user data
	//$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/transporter/web/verify.php?action=verify_user&code=' . $idBinary;
	
	$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/backend/actions/verify.php?action=verify_user&code=' . $idBinary;
	
	//使用163邮箱服务器
	$smtpserver = "smtp.163.com";
	//163邮箱服务器端口 
	$smtpserverport = 25;
	//你的163服务器邮箱账号
	$smtpusermail = "palaso@163.com";
	//收件人邮箱
	$smtpemailto = $useremail;
	//你的邮箱账号(去掉@163.com)
	$smtpuser = "palaso";//SMTP服务器的用户帐号 
	//你的邮箱密码
	$smtppass = "bruopspudjhndhwf"; //SMTP服务器的用户密码 
        $headers = "";


	//邮件主题 
	
	/*
	$to      = 'junhuibai@gmail.com';
	$subject = iconv('','GB2312','亲爱的'.$s_user.'，请取回您的密码！');
	$subject = "=?GB2312?B?".base64_encode($subject)."?=";
	$message = $s_user.'，您好！'.
	*/
	$mailsubject = "中质国检邮箱验证";
	//$mailsubject = iconv('','UTF-8','中质国检邮箱验证');
	$mailsubject = "=?UTF-8?B?".base64_encode($mailsubject)."?=";
	$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; 
	
	
	//邮件内容 
	$mailbody = $user_account . "您好：<br/>您的验证地址为：<a href='". $root_dir . "' target='_blank'>" . $root_dir . "</a><br/>请点击验证。";
	//邮件格式（HTML/TXT）,TXT为文本邮件 
	$mailtype = "HTML";
	//这里面的一个true是表示使用身份验证,否则不使用身份验证. 
	$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
	//是否显示发送的调试信息 
	$smtp->debug = TRUE;
	//发送邮件
	//$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); 
	$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype,'','',$headers);
}

function sendResetPasswordMail1($user_account,$useremail, $userid, $pw){
	
	//$userid=$_GET['id'];
	//$useremail = $_GET['email'];
	
	
	//$idBinary = md5($userid);
	// user data
	//$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/transporter/web/verify.php?action=verify_user&code=' . $idBinary;
	
	//$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/glory/backend/actions/verify.php?action=verify_user&code=' . $idBinary;
	
	//使用163邮箱服务器
	$smtpserver = "smtp.gj-china.net";
	//163邮箱服务器端口 
	$smtpserverport = 25;
	//你的163服务器邮箱账号
	$smtpusermail = "verify@gj-china.net";
	//收件人邮箱
	$smtpemailto = $useremail;
	//你的邮箱账号(去掉@163.com)
	$smtpuser = "verify@gj-china.net";//SMTP服务器的用户帐号 
	//你的邮箱密码
	$smtppass = "gj-china99"; //SMTP服务器的用户密码 
        $headers = "";


	//邮件主题 
	
	/*
	$to      = 'junhuibai@gmail.com';
	$subject = iconv('','GB2312','亲爱的'.$s_user.'，请取回您的密码！');
	$subject = "=?GB2312?B?".base64_encode($subject)."?=";
	$message = $s_user.'，您好！'.
	*/
	$mailsubject = "中质国检会员密码重置";
	//$mailsubject = iconv('','UTF-8','中质国检会员密码重置');
	$mailsubject = "=?UTF-8?B?".base64_encode($mailsubject)."?=";
	$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; 
	
	
	//邮件内容 
	$mailbody = $user_account . "您好：<br/>您的密码已重置为：" . $pw . "<br/>出于安全考虑，请及时修改密码。";
	//邮件格式（HTML/TXT）,TXT为文本邮件 
	$mailtype = "HTML";
	//这里面的一个true是表示使用身份验证,否则不使用身份验证. 
	$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
	//是否显示发送的调试信息 
	$smtp->debug = TRUE;
	//发送邮件
	//$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); 
	$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype,'','',$headers);
}

function sendResetPasswordMail($user_account,$useremail, $userid, $pw){
	
	//$userid=$_GET['id'];
	//$useremail = $_GET['email'];
	
	
	//$idBinary = md5($userid);
	// user data
	//$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/transporter/web/verify.php?action=verify_user&code=' . $idBinary;
	
	//$root_dir = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"] . '/glory/backend/actions/verify.php?action=verify_user&code=' . $idBinary;
	
	//使用163邮箱服务器
	$smtpserver = "smtp.gj-china.net";
	//163邮箱服务器端口 
	$smtpserverport = 25;
	//你的163服务器邮箱账号
	$smtpusermail = "verify@gj-china.net";
	//收件人邮箱
	$smtpemailto = $useremail;
	//你的邮箱账号(去掉@163.com)
	$smtpuser = "verify@gj-china.net";//SMTP服务器的用户帐号 
	//你的邮箱密码
	$smtppass = "gj-china99"; //SMTP服务器的用户密码 
        $headers = "";


	//邮件主题 
	
	/*
	$to      = 'junhuibai@gmail.com';
	$subject = iconv('','GB2312','亲爱的'.$s_user.'，请取回您的密码！');
	$subject = "=?GB2312?B?".base64_encode($subject)."?=";
	$message = $s_user.'，您好！'.
	*/
	$mailsubject = "中质国检会员密码重置";
	//$mailsubject = iconv('','UTF-8','中质国检会员密码重置');
	$mailsubject = "=?UTF-8?B?".base64_encode($mailsubject)."?=";
	$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; 
	
	
	//邮件内容 
	$mailbody = $user_account . "您好：<br/>您的密码已重置为：" . $pw . "<br/>出于安全考虑，请及时修改密码。";
	//邮件格式（HTML/TXT）,TXT为文本邮件 
	$mailtype = "HTML";
	//这里面的一个true是表示使用身份验证,否则不使用身份验证. 
	$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
	//是否显示发送的调试信息 
	$smtp->debug = TRUE;
	//发送邮件
	//$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); 
	$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype,'','',$headers);
}